<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //创建正则第一种方式
        const reg1 = /abc/
        //创建正则第二种方式
        const reg2 = new RegExp(/abc/)

        const str1 = "abcdefg"
        const str2 = "ab1cdefg"
        const str3 = "11abcdefg"
        console.log(reg1.test(str1));//true
        console.log(reg1.test(str2));//false
        console.log(reg1.test(str3));//true
    </script>
</body>
</html>